#ifndef __ACCEPTOR_H_
#define __ACCEPTOR_H_

#include "InetAddress.hpp"
#include "Socket.hpp"

namespace ln{

class Acceptor{
public:
    Acceptor(unsigned short port,const string & ip = "127.0.0.1");
    void ready();
    int accept();
    int fd() const { return _listensock.fd(); }

private:
    void setReuseAddr(bool);
    void setReusePort(bool);
    void bind();
    void listen();

private:
    InetAddress _addr;
    Socket      _listensock;
};

}//end of namespace ln

#endif

